package biiaoqi;

public class student implements Comparable<student>{
    private String name;
    private int age;
    private int gender;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", gender=" + gender +
                '}';
    }

    public student(String name, int age, int gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;

    }
    public  student(){}


    //内部比较器
   @Override
    public int compareTo(student o){
       return o.getAge()==this.getAge()?o.getGender()-this.getGender():o.getAge()-this.getAge();
   }
}
